library(tidyverse) # tidy universe
library(viridis) # nice color palette
library(readxl) # read Excel filesMap Baltic Sea Data
Goals of the Workshop
- Show how to make maps of raster data ->
terrapackage. - Show how to make maps of vector data ->
sfpackage. - Introduce some basics of GIS shapefiles.
- Show how to convert those shapefiles into data frames that
ggplot2andtidyterracan deal with
Basic libraries
Using data from rnaturalearth
The rnaturalearth package facilitates interaction with natural earth vector map data. The package contains pre-downloaded vector maps of countries: ne_countries(), states: ne_states(), coastline: ne_coastline(). It also has ne_download() function to facilitate download of other vector and raster maps.
library(rnaturalearth) # natural earth data
#library(rnaturalearthhires) # high resolution natural earth dataGet Natural Earth data
Retrieve vector data of the world, continents, countries. Use the argument scale to return maps of different resolutions: ‘small’, ‘medium’, ‘large’.
The function ne_countries() reads the data in as a regular dataframe, with the spatial component of the data contained inside a geometry list-column within the dataframe (Look at the last column of the dataframe.). That means you can operate on this data as you would any data frame, because the geometry column will always stick with the data. This is the same as the st_read() function of the sf package (see below).
# default. returnclass = "sf"
world <- rnaturalearth::ne_countries(scale = "small")
europe <- rnaturalearth::ne_countries(scale = "medium",
continent = "Europe")Make Natural Earth maps
Create maps with geom_sf() from the ggplot2 R package, i.e. as a ggplot.
ggplot() +
geom_sf(data = world)Use the world data to plot Europe by defining a geographic range using coord_sf.
ggplot() +
geom_sf(data = world) +
coord_sf(xlim = c(-20, 50),
ylim = c(33, 80)) +
labs(x = "Longitude",
y = "Latitude",
title = "Europe")TASK 1:
- Use the
europedata to plot the Baltic Sea area. - Use
coord_sf()to define the geographic range (10°E to 30°E, 53°N to 66°N) - Fill the countries in different colours.
- Colour the water in blue.
For 3) and 4) look at the columns of the data frame.
Solution of Task 1 (unfold):
Code
ggplot() +
geom_sf(data = europe,
aes(fill = admin)) +
coord_sf(xlim = c(10, 30),
ylim = c(53, 66)) +
scale_fill_viridis(discrete = TRUE) +
labs(x = "Longitude",
y = "Latitude",
title = "Baltic Sea") +
guides(fill = "none") +
theme_minimal() +
theme(panel.background = element_rect(fill = "lightblue",
colour = NaN),
panel.grid.major = element_line(colour = NaN))Add Baltic Sea raster data to the map (1/4)
You can download data from the Copernicus Marine Data Store here: https://data.marine.copernicus.eu/products?facets=areas%7EBaltic+Sea.
Save the data in a folder of your choice, I name it data/copernicus.
The data sets are in the NetCDF data format. Instead of using the functionality of the RNetCDF R package to read in NetCDF data (open.nc(), var.get.nc()), we can use the much more convenient rast() from the terra package.
library(terra) # rast()
library(tidyterra) # ggplot of terra raster dataRead NetCDF data from Copernicus Marine Service
When reading the NetCDF data with terra::rast(), a SpatRaster object is created. A SpatRaster represents a spatially referenced surface divided into three dimensional cells (rows, columns, and layers).
copernicus <- rast("./data/copernicus/cmems_mod_bal_phy_anfc_P1M-m_1728829730861.nc")Check dimensions (only one depth and only one time step). If not, then process the data, i.e. select one depth and one time step.
class(copernicus)[1] "SpatRaster"
attr(,"package")
[1] "terra"
print(copernicus)class : SpatRaster
dimensions : 774, 763, 1 (nrow, ncol, nlyr)
resolution : 0.02777831, 0.01666584 (x, y)
extent : 9.027693, 30.22255, 52.99996, 65.89932 (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (CRS84) (OGC:CRS84)
source : cmems_mod_bal_phy_anfc_P1M-m_1728829730861.nc
varname : thetao (Potential temperature)
name : thetao_depth=0.50164622
unit : degree_Celsius
time : 2024-04-01 UTC
Make a first plot
As the terra package is loaded, we can use the plot() function to plot the values of the SpatRaster to make a map.
terra::plot(copernicus)Now we draw a map using ggplot() and the geom_spatraster() from the tidyterra R package.
ggplot() +
geom_spatraster(data = copernicus) +
scale_fill_viridis() +
labs(x = "Longitude",
y = "Latitude",
title = "Baltic Sea") +
guides(fill = "none") +
theme_minimal()Add the Copernicus data to the Baltic Sea map
To combine the vector data from Natural Earth with the raster data, we need to ensure that both the raster and vector data are in the same Coordinate Reference System (CRS). Use crs() function in terra to check and reproject if necessary or st_crs() from the sf package.
library(sf)Need to make sure CRS is the same!
europe <- ne_countries(scale = "medium", continent = "Europe")
st_crs(copernicus)==st_crs(europe)[1] TRUE
# Reproject vector data to match the raster (if CRS is different)
# europe <- st_transform(europe, crs(copernicus))The europe data is a regular dataframe, with the spatial component of the data contained inside a geometry list-column within the dataframe.
We could use this, but this time we create a SpatVector object with the vect() function from the terra package.
class(europe)[1] "sf" "data.frame"
europe <- terra::vect(europe)
class(europe)[1] "SpatVector"
attr(,"package")
[1] "terra"
TASK 2:
- Plot the
copernicusraster data as a base map usinggeom_spatraster(). - Add the
europevector data as a second layer (see Task 1). you can also usegeom_spatvector() - Look at the map if you don’t use
coord_sf()to define the geographic range.
Solution of Task 2 (unfold):
Code
ggplot() +
geom_spatraster(data = copernicus) +
geom_spatvector(data = europe) +
coord_sf(xlim = c(10, 30), ylim = c(53, 66)) +
scale_fill_viridis() +
labs(x = "Longitude",
y = "Latitude",
title = "Baltic Sea") +
guides(fill = "none") +
theme_minimal()Add Baltic Sea raster data to the vector data (2/4)
You can download bathymetry data processed at IOW here: https://www.io-warnemuende.de/topography-of-the-baltic-sea.html.
Save the data in a folder of your choice, I name it data/iow.
The data sets are in the NetCDF data format. Instead of using the functionality of the RNetCDF R package to read in NetCDF data (open.nc(), var.get.nc()), we can use the much more convenient rast() from the terra package.
library(terra) # rast()
library(tidyterra) # ggplot of terra raster dataRead NetCDF data from the IOW webpage
# Entire Baltic Sea
iowtopo <- rast("./data/iow/iowtopo_nc/iowtopo2_rev03.nc")
# Southwestern part of Baltic Sea
# iowtopo <- rast("./data/iow/iowtopo_nc/iowtopo1_rev02.nc")Look at the structure of the data.
class(iowtopo)[1] "SpatRaster"
attr(,"package")
[1] "terra"
iowtopoclass : SpatRaster
dimensions : 750, 660, 12 (nrow, ncol, nlyr)
resolution : 0.03333333, 0.01666667 (x, y)
extent : 9, 31, 53.5, 66 (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (CRS84) (OGC:CRS84)
sources : iowtopo2_rev03.nc:Z_TOPO
iowtopo2_rev03.nc:Z_WATER
iowtopo2_rev03.nc:Z_LAND
... and 9 more source(s)
varnames : Z_TOPO (IF Z_12 GE 0 THEN 0.1*INT(10*Z_12+0.5) ELSE 0.1*INT(10*Z_12-0.5))
Z_WATER (IF Z_W12 GE 0 THEN 0.1*INT(10*Z_W12+0.5) ELSE 0.1*INT(10*Z_W12-0.5))
Z_LAND (mean gtopo30 land height)
...
names : Z_TOPO, Z_WATER, Z_LAND, Z_MIN, Z_MAX, Z_STDEV, ...
unit : m, m, m, m, m, m, ...
res(iowtopo)[1] 0.03333333 0.01666667
Use the plot() function to have an overview of the data contained in this raster object.
plot(iowtopo)plot(iowtopo$Z_TOPO)plot(iowtopo$LANDMASK)You could do some data processing and get summary statistics, here only two very simple examples.
global(iowtopo$Z_TOPO, mean) mean
Z_TOPO 131.2264
freq(iowtopo$Z_TOPO, value = 10) layer value count
1 1 10 1567
Here we process the data to only keep the bathymetry of the Baltic Sea (negative values), i.e. cut off at zero. Positive values (land) are set to NaN.
# subst(x, from, to, others=NULL, raw=FALSE, filename="", ...)
# clamp(x, lower=-Inf, upper=Inf, values=TRUE, filename="", ...)
topo <- terra::clamp(iowtopo$Z_TOPO, upper= 0, values=FALSE)
# land <- terra::subst(iowtopo$LANDMASK, 0, NA)Use available geom_s of tidyterra to map the bathymetry data in different ways:
geom_spatraster()geom_spatraster_contour()geom_spatraster_contour_filled()
ggplot() +
tidyterra::geom_spatraster(data = topo) +
coord_sf(xlim = c(10, 30), ylim = c(53, 66)) +
tidyterra::scale_fill_whitebox_c(
palette = "deep",
n.breaks = 12,
guide = guide_legend(reverse = TRUE)
) +
labs(x = "Longitude",
y = "Latitude",
fill = "Z_TOPO",
title = "Topography of the Baltic Sea",
subtitle = "iowtopo2_rev03")ggplot() +
geom_spatraster(data = topo) +
geom_spatraster_contour(data = topo,
breaks = c(-50, -100),
color = "grey10") +
scale_fill_whitebox_c(
palette = "deep",
n.breaks = 12,
guide = guide_legend(reverse = TRUE)
) +
labs(x = "Longitude",
y = "Latitude",
fill = "Z_TOPO",
title = "Topography of the Baltic Sea",
subtitle = "iowtopo2_rev03")ggplot() +
geom_spatraster_contour_filled(data = topo,
breaks = c(0, -50, -100, -Inf),
color = "grey10") +
scale_colour_whitebox_c(
palette = "muted",
n.breaks = 12,
guide = guide_legend(reverse = TRUE)
) +
labs(x = "Longitude",
y = "Latitude",
fill = "Z_TOPO",
title = "Topography of the Baltic Sea",
subtitle = "iowtopo2_rev03")Add ODIN point data to the Baltic Sea raster data (3/4)
Read csv ODIN data
Pay attention, the ODIN.csv file is comma separated but the column names are distributed over the first three rows. You can use this work around of first extracting the column names and than reading the data and skipping the first three rows.
In addition, some meta data information is contained in the last 4 rows. Using slice() you cut these rows.
Of course, you could make these adjustments manually before reading the data.
col_names <- names(read_csv("./data/iow/odin2_2024-10-14_104811_comma.csv",
n_max = 0))
odin <- read_csv("./data/iow/odin2_2024-10-14_104811_comma.csv",
col_names = col_names,
skip = 3) %>%
dplyr::select(1, 2, 3, 4, 8, 11, 14, 15) %>%
slice(-c(922:925))
# rename the columns
colnames(odin) <- c("station",
"year", "month", "day",
"lon", "lat",
"depth", "oxy")
# create a column date
odin <- odin %>%
mutate(date = paste0(year, month, day)) %>%
mutate(date = lubridate::ymd(date)) %>%
dplyr::select(-c(year, month, day))Select data from one cruise, here May 2023.
odin.may <- odin %>%
filter(year(date) == 2023, month(date) == 5)Select the lowest depth (surface values) of each station.
odin.may.surf <- odin.may %>%
group_by(station) %>%
slice_min(depth) %>%
ungroup()Adding data as points to the map
The data to be plotted on a map are in a data frame odin.may.surf.
We need to convert the data frame to a spatial sf object. EPSG:4326 corresponds to the WGS 84 geographic coordinate system, which is based on latitude and longitude coordinates and widely used for mapping.
odin_sf <- st_as_sf(odin.may.surf,
coords = c("lon", "lat"),
crs = 4326)Now we draw a map using ggplot() and the geom_spatraster() from the tidyterra R package to plot the bathymetry of the Baltic Sea and geom_sf() to plot the ODIN point data.
ggplot() +
tidyterra::geom_spatraster(data = topo) +
coord_sf(xlim = c(10, 30),
ylim = c(53, 66)) +
tidyterra::scale_fill_hypso_c(
palette = "meyers_bathy",
n.breaks = 12,
guide = "none",
alpha = 1) +
# Add station numbers to points
geom_sf(data = odin_sf,
aes(geometry = geometry,
col = oxy),
size = 3) +
scale_color_viridis()+
# Add station numbers to points
# geom_sf_text(data = odin_sf,
# aes(label = station),
# nudge_y = 0.3, size = 3) +
labs(x = "Longitude",
y = "Latitude",
col = "Oxygen concentration [ml/l]",
title = "Surface oxygen concentration the Baltic Sea",
subtitle = "iowtopo2_rev03")TASK 3:
- Plot the oxygen concentration of August 2023 onto a map.
- Select the bottom values of each station.
- Show only the central part of the Baltic Sea (where the station data are from) -> define region
crop_extent <- ext(10, 22, 53, 59)and then crop thetoporaster withcropped_topo <- crop(topo, crop_extent) - Use maybe a diverging color scale for the points.
Solution of TASK 3 (unfold):
Code
odin.august <- odin %>%
filter(year(date) == 2023,
month(date) == 8)
odin.august.bottom <- odin.august %>%
group_by(station) %>%
slice_max(depth) %>%
ungroup()
odin_sf2 <- st_as_sf(odin.august.bottom,
coords = c("lon", "lat"),
crs = 4326)Code
# Define the extent (xmin, xmax, ymin, ymax)
crop_extent <- ext(10, 22.3, 53, 59.3)
# Crop the raster using the defined extent
cropped_topo <- crop(topo, crop_extent)Code
ggplot() +
tidyterra::geom_spatraster(data = cropped_topo) +
coord_sf(xlim = c(10, 22.3),
ylim = c(53, 59.3)) +
tidyterra::scale_fill_hypso_c(
palette = "meyers_bathy",
n.breaks = 12,
guide = "none",
alpha = 1) +
# Add station numbers to points
geom_sf(data = odin_sf2,
aes(geometry = geometry,
col = oxy),
size = 3) +
scale_color_whitebox_c(palette = "muted")+
labs(x = "Longitude",
y = "Latitude",
col = "Oxygen concentration [ml/l]",
title = "Bottom oxygen concentration the Baltic Sea",
subtitle = "iowtopo2_rev03")Add ICES DATRAS trawl survey data to the Baltic Sea raster data (4/4)
ICES is the International Council for the Exploration of the Sea. The icesDatras package provides functions that access the web services of the ICES DATRAS trawl survey database.
library(icesDatras)
library(icesVocab)Acess survey data
Information on available surveys in DATRAS:
getSurveyList() [1] "BITS" "BTS" "BTS-GSA17" "BTS-VIII"
[5] "Can-Mar" "DWS" "DYFS" "EVHOE"
[9] "FR-CGFS" "FR-WCGFS" "IE-IAMS" "IE-IGFS"
[13] "IS-IDPS" "NIGFS" "NL-BSAS" "NS-IBTS"
[17] "NS-IBTS_UNIFtest" "NS-IDPS" "NSSS" "PT-IBTS"
[21] "ROCKALL" "SCOROC" "SCOWCGFS" "SE-SOUND"
[25] "SNS" "SP-ARSA" "SP-NORTH" "SP-PORC"
[29] "SWC-IBTS" "Test-DATRAS"
Extracting catch weight of cod from the Baltic Sea survey, year 2019, quarter 1. Note: The icesVocab package provides findAphia(), a function to look up Aphia species codes.
aphia <- icesVocab::findAphia("cod")
survey <- "BITS"
years <- 2019
quarters <- 1codwgt <- getCatchWgt(survey, years, quarters, aphia)
codwgt <- codwgt %>%
dplyr::select(RecordType,
Survey,
Quarter,
Country,
Ship,
StNo,
ShootLat,
ShootLong,
HaulLat,
HaulLong,
CatchWgt)
head(codwgt) RecordType Survey Quarter Country Ship StNo ShootLat ShootLong HaulLat
1 HH BITS 1 LT AA36 26206 55.7600 20.3333 55.7350
2 HH BITS 1 LT AA36 26193 55.6533 20.2866 55.6366
3 HH BITS 1 LT AA36 26057 55.7166 19.9666 55.7166
4 HH BITS 1 LT AA36 26134 55.9516 20.4733 55.9400
5 HH BITS 1 LT AA36 26052 55.5066 20.6133 55.4833
6 HH BITS 1 LT AA36 26153 55.4833 20.6483 55.5000
HaulLong CatchWgt
1 20.3350 119381
2 20.2583 NA
3 20.0116 NA
4 20.4333 38000
5 20.6350 64000
6 20.6133 191875
Adding data as points to the map
The data to be plotted on a map are in a data frame codwgt.
We need to convert the codwgt data frame to a spatial sf object. EPSG:4326 corresponds to the WGS 84 geographic coordinate system, which is based on latitude and longitude coordinates and widely used for mapping.
codwgt_sf <- st_as_sf(codwgt,
coords = c("HaulLong", "HaulLat"),
crs = 4326)Now we draw a map using ggplot() and the geom_spatraster() from the tidyterra R package to plot the topography and geom_sf() to plot the ODIN point data.
ggplot() +
tidyterra::geom_spatraster(data = cropped_topo) +
coord_sf(xlim = c(10, 22.3),
ylim = c(53, 59.3)) +
tidyterra::scale_fill_hypso_c(
palette = "meyers_bathy",
n.breaks = 12,
guide = "none",
alpha = 1) +
# Add station numbers to points
geom_sf(data = codwgt_sf,
aes(geometry = geometry,
col = CatchWgt),
size = 4, alpha = 0.5) +
scale_color_viridis()+
labs(x = "Longitude",
y = "Latitude",
col = "Cod weight",
title = "Catch weight of cod, Baltic Sea survey (01/2019)",
subtitle = "ICES DATRAS trawl survey database")Using the sf package for shapefiles
Shapefiles: the GIS concept
In most cases, geographic information for maps is stored in a more complex format, commonly referred to as a shapefile. A shapefile consists of several component files. Not all components are needed, but each shapefile must have at least the following three component files:
- .shp: The main shape file. This file contains all the information needed to draw geographic features such as points, lines, and polygons.
- .shx: The shape index file, which organizes the geometries in a way that is easily read by programs.
- .dbf: The attribute file. This contains the actual data associated with each geographic feature, such as the population or area of each country.
Shapefiles allow you to easily draw different polygons (i.e. countries, administrative divisions), lines (i.e. roads, rivers), and points (i.e. fire departments, mountains, battles).
R-spatial evolution: retirement of rgdal, rgeos and maptools!! The functionality of these packages has been replaced by other, more modern packages like sf and terra.
sf package
The sf package reads the shapefile in as a regular dataframe, with the spatial component of the data contained inside a geometry list-column within the dataframe. That means you can operate on this data as you would any data frame, because the geometry column will always stick with the data.
library(sf) # "simple features" spatial package
library(ggspatial) # add scale barsRead data
This dataset shows the sub-drainage areas of the Baltic Sea catchment area. It can be downloaded from the HELCOM metadata catalogue: https://metadata.helcom.fi/geonetwork/srv/api/records/9e132cda-8f69-4f7a-9c66-8b9859e61441.
Save the data in a folder of your choice, I name it data/helcom.
baltic_drain <- st_read("./data/helcom/_ags_DrainageBasin_1/DrainageBasin_1.shp")Reading layer `DrainageBasin_1' from data source
`D:\Eggert\Documents\FBN\ORDS-MV-BalticData\ORDS-MV-BalticData\data\helcom\_ags_DrainageBasin_1\DrainageBasin_1.shp'
using driver `ESRI Shapefile'
Simple feature collection with 190 features and 6 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 907445 ymin: 6272134 xmax: 4236201 ymax: 10856250
Projected CRS: WGS 84 / Pseudo-Mercator
baltic_bathy <- st_read("./data/helcom/_ags_DepthContours_1/DepthContours_1.shp")Reading layer `DepthContours_1' from data source
`D:\Eggert\Documents\FBN\ORDS-MV-BalticData\ORDS-MV-BalticData\data\helcom\_ags_DepthContours_1\DepthContours_1.shp'
using driver `ESRI Shapefile'
Simple feature collection with 510 features and 5 fields
Geometry type: LINESTRING
Dimension: XY
Bounding box: xmin: 941370.7 ymin: 7160996 xmax: 3320556 ymax: 9794368
Projected CRS: WGS 84 / Pseudo-Mercator
# baltic <- st_read("./data/helcom/_ags_coastline/coastline.shp")Look at the data structure:
class(baltic_drain)[1] "sf" "data.frame"
print(baltic_drain)Simple feature collection with 190 features and 6 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 907445 ymin: 6272134 xmax: 4236201 ymax: 10856250
Projected CRS: WGS 84 / Pseudo-Mercator
First 10 features:
BASINS_ID MAJID SUBID DESCRIPT Shape_Leng Shape_Area
1 2 1 10 Bothnian Bay Sub-basin 3623988.4 282533757660
2 3 1 12 Bothnian Bay Sub-basin 3628839.5 348069050004
3 4 1 6 Bothnian Bay Sub-basin 2496437.6 173199703729
4 5 1 8 Bothnian Bay Sub-basin 2121198.2 119751080374
5 6 1 4 Bothnian Bay Sub-basin 1857241.8 71585475810
6 7 1 7 Bothnian Bay Sub-basin 1746254.4 38947943714
7 8 1 2 Bothnian Bay Sub-basin 2229130.9 65931085227
8 9 2 35 Bothnian Sea Sub-basin 2374587.0 151466261263
9 10 1 9 Bothnian Bay Sub-basin 781060.9 10637045721
10 11 1 13 Bothnian Bay Sub-basin 1155917.5 38691945807
geometry
1 POLYGON ((2437500 10814947,...
2 POLYGON ((2683171 10689353,...
3 POLYGON ((1787170 10245955,...
4 POLYGON ((1991988 10442824,...
5 POLYGON ((1779382 10123493,...
6 POLYGON ((2244511 10201601,...
7 POLYGON ((1730181 10039933,...
8 POLYGON ((1746825 9699945, ...
9 POLYGON ((2556830 10042342,...
10 POLYGON ((2729609 9808754, ...
Retrieve coordinate reference system from object:
st_crs(baltic_drain)Coordinate Reference System:
User input: WGS 84 / Pseudo-Mercator
wkt:
PROJCRS["WGS 84 / Pseudo-Mercator",
BASEGEOGCRS["WGS 84",
ENSEMBLE["World Geodetic System 1984 ensemble",
MEMBER["World Geodetic System 1984 (Transit)"],
MEMBER["World Geodetic System 1984 (G730)"],
MEMBER["World Geodetic System 1984 (G873)"],
MEMBER["World Geodetic System 1984 (G1150)"],
MEMBER["World Geodetic System 1984 (G1674)"],
MEMBER["World Geodetic System 1984 (G1762)"],
MEMBER["World Geodetic System 1984 (G2139)"],
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]],
ENSEMBLEACCURACY[2.0]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]],
CONVERSION["Popular Visualisation Pseudo-Mercator",
METHOD["Popular Visualisation Pseudo Mercator",
ID["EPSG",1024]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["False easting",0,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",0,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["easting (X)",east,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["northing (Y)",north,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Web mapping and visualisation."],
AREA["World between 85.06°S and 85.06°N."],
BBOX[-85.06,-180,85.06,180]],
ID["EPSG",3857]]
Make simple maps with plot()
Using the base function plot() and without any specification, many plots are created based on the different columns in the data frame:
plot(baltic_drain)The st_geometry() function can be used to retrieve the simple feature geometry list-column (sfc).
plot(st_geometry(baltic_drain),
col="grey80",
main="Baltic Sea Drainage Basin",
axes=TRUE)plot(st_geometry(baltic_bathy),
col="grey80",
main="Baltic Bathymetry",
axes=TRUE)Only plot the -50 m contour line:
baltic_bathy_50 <- baltic_bathy %>%
dplyr::filter(CONTOUR == -50)
plot(st_geometry(baltic_bathy_50),
col="grey80",
main="Baltic Bathymetry",
axes=TRUE)Using ggplot2 and sf
We can also use ggplot2 to plot the sf data. Since these data are all data frames (sf features), we can use the geom_sf() function.
ggplot() +
geom_sf(data = baltic_drain)TASK 4:
- Plot the
baltic_drainvector data using eithergeom_sf()ortidyterra::geom_spatvector(). - Colour the drainage basins in different colours.
Solution of TASK 4 (unfold):
Code
ggplot() +
geom_sf(data = baltic_drain,
fill = "orange", alpha = 0.7, color="red", lwd=0.4,
show.legend = FALSE) +
labs(x = "Longitude",
y = "Latitude",
title = "Baltic Sea Drainage Basin") +
theme_minimal()Adding scale bars and a north arrow
We can use the package ggspatial, which provides an easy function for creating scale bars / north arrows.
ggplot() +
geom_sf(data = baltic_drain,
aes(fill = DESCRIPT),
alpha = 0.7,
color="grey30",
lwd=0.4,
show.legend = FALSE) +
scale_fill_viridis_d() +
labs(x = "Longitude",
y = "Latitude",
title = "Baltic Sea Drainage Basin") +
annotation_scale(location = "bl",
width_hint = 0.4) +
annotation_north_arrow(location = "tl",
which_north = "true",
pad_x = unit(0.0, "in"),
pad_y = unit(0.2, "in"),
style = north_arrow_fancy_orienteering) +
theme_minimal()Adding points to the map
We add the some cities to the map. We manually create a new dataframe cities and then add those data to the map.
We need to convert the cities data frame to a spatial sf object. EPSG:4326 corresponds to the WGS 84 geographic coordinate system, which is based on latitude and longitude coordinates and widely used for mapping.
cities <- data.frame(city_name=c("Rostock", "Kopenhagen", "Stockholm", "Helsinki"))
cities$lat <- c(54.0886707, 55.6867243, 59.3251172, 60.1674881)
cities$lon <- c(12.1400211, 12.5700724, 18.0710935, 24.9427473)cities_sf <- st_as_sf(cities, coords = c("lon", "lat"), crs = 4326)ggplot() +
geom_sf(data = baltic_drain,
fill = "orange",
alpha = 0.7,
color="red",
lwd=0.4,
show.legend = FALSE) +
labs(x = "Longitude",
y = "Latitude",
title = "Baltic Sea Drainage Basin") +
annotation_scale(location = "bl",
width_hint = 0.4) +
annotation_north_arrow(location = "tl",
which_north = "true",
pad_x = unit(0.0, "in"),
pad_y = unit(0.2, "in"),
style = north_arrow_fancy_orienteering) +
# Add cities as points with labels
geom_sf(data = cities_sf,
aes(geometry = geometry),
color = "red",
size = 3) +
geom_sf_text(data = cities_sf,
aes(label = city_name),
nudge_y = 0.3, size = 3) +
theme_minimal()Query Open Street Maps / Google maps with ggmap
The osmdata package provides spatial data about a wide range of spatial properties and objects across the world. ggmap simplifies the process of downloading base maps from Open Street Maps (or Google maps) to use in the background of your plots.
library(ggmap)
library(osmdata)Available features
The available_features() function can be used to get the list of recognized features in OSM. A list of the available features can be found in the OSM wiki.
available_features() [1] "4wd_only" "abandoned"
[3] "abutters" "access"
[5] "addr" "addr:city"
[7] "addr:conscriptionnumber" "addr:country"
[9] "addr:county" "addr:district"
[11] "addr:flats" "addr:full"
[13] "addr:hamlet" "addr:housename"
[15] "addr:housenumber" "addr:inclusion"
[17] "addr:interpolation" "addr:place"
[19] "addr:postbox" "addr:postcode"
[21] "addr:province" "addr:state"
[23] "addr:street" "addr:subdistrict"
[25] "addr:suburb" "addr:unit"
[27] "admin_level" "aeroway"
[29] "agricultural" "alcohol"
[31] "alt_name" "amenity"
[33] "area" "atv"
[35] "backward" "barrier"
[37] "basin" "bdouble"
[39] "bicycle" "bicycle_road"
[41] "biergarten" "boat"
[43] "border_type" "boundary"
[45] "brand" "bridge"
[47] "building" "building:architecture"
[49] "building:colour" "building:fireproof"
[51] "building:flats" "building:material"
[53] "building:min_level" "building:part"
[55] "building:soft_storey" "bus_bay"
[57] "busway" "capacity"
[59] "castle_type" "change"
[61] "charge" "clothes"
[63] "construction" "construction#Railways"
[65] "construction_date" "covered"
[67] "craft" "crossing"
[69] "crossing:island" "cuisine"
[71] "cutting" "cycleway"
[73] "cycleway:left" "cycleway:left:oneway"
[75] "cycleway:right" "cycleway:right:oneway"
[77] "denomination" "destination"
[79] "diet:*" "direction"
[81] "dispensing" "disused"
[83] "dog" "drinking_water"
[85] "drinking_water:legal" "drive_in"
[87] "drive_through" "ele"
[89] "electric_bicycle" "electrified"
[91] "embankment" "embedded_rails"
[93] "emergency" "end_date"
[95] "entrance" "est_width"
[97] "fee" "female"
[99] "fire_object:type" "fire_operator"
[101] "fire_rank" "food"
[103] "foot" "footway"
[105] "ford" "forestry"
[107] "forward" "frequency"
[109] "fuel" "gauge"
[111] "golf_cart" "goods"
[113] "hazard" "hazmat"
[115] "healthcare" "healthcare:counselling"
[117] "healthcare:speciality" "height"
[119] "hgv" "highway"
[121] "historic" "horse"
[123] "hot_water" "ice_road"
[125] "incline" "industrial"
[127] "inline_skates" "inscription"
[129] "int_name" "internet_access"
[131] "junction" "kerb"
[133] "landuse" "lane_markings"
[135] "lanes" "lanes:bus"
[137] "lanes:psv" "layer"
[139] "leaf_cycle" "leaf_type"
[141] "leisure" "lhv"
[143] "lit" "loc_name"
[145] "location" "male"
[147] "man_made" "max_age"
[149] "max_level" "maxaxleload"
[151] "maxheight" "maxlength"
[153] "maxspeed" "maxstay"
[155] "maxweight" "maxwidth"
[157] "military" "min_age"
[159] "min_level" "minspeed"
[161] "mofa" "moped"
[163] "motor_vehicle" "motorboat"
[165] "motorcar" "motorcycle"
[167] "motorroad" "mountain_pass"
[169] "mtb:description" "mtb:scale"
[171] "name" "name:left"
[173] "name:right" "name_1"
[175] "name_2" "narrow"
[177] "nat_name" "natural"
[179] "nickname" "noexit"
[181] "non_existent_levels" "nudism"
[183] "office" "official_name"
[185] "old_name" "oneway"
[187] "oneway:bicycle" "openfire"
[189] "opening_hours" "opening_hours:drive_through"
[191] "operator" "orientation"
[193] "oven" "overtaking"
[195] "parking" "parking:condition"
[197] "parking:lane" "passing_places"
[199] "place" "power"
[201] "power_supply" "priority"
[203] "priority_road" "produce"
[205] "proposed" "protected_area"
[207] "psv" "public_transport"
[209] "railway" "railway:preserved"
[211] "railway:track_ref" "recycling_type"
[213] "ref" "ref_name"
[215] "reg_name" "religion"
[217] "religious_level" "rental"
[219] "residential" "roadtrain"
[221] "route" "sac_scale"
[223] "sauna" "service"
[225] "service_times" "shelter_type"
[227] "shop" "short_name"
[229] "shoulder" "shower"
[231] "sidewalk" "site"
[233] "ski" "smoking"
[235] "smoothness" "social_facility"
[237] "sorting_name" "speed_pedelec"
[239] "sport" "start_date"
[241] "step_count" "substation"
[243] "surface" "tactile_paving"
[245] "tank" "tidal"
[247] "toilets" "toilets:wheelchair"
[249] "toll" "topless"
[251] "tourism" "tracks"
[253] "tracktype" "traffic_calming"
[255] "traffic_sign" "trail_visibility"
[257] "trailblazed" "trailblazed:visibility"
[259] "tunnel" "turn"
[261] "type" "unisex"
[263] "usage" "vehicle"
[265] "vending" "voltage"
[267] "water" "wheelchair"
[269] "wholesale" "width"
[271] "winter_road" "wood"
The available_tags() function lists out the tags associated with each feature. The tags associated with the feature “amenity” can be retrieved as follows.
available_tags("amenity")# A tibble: 137 × 2
Key Value
<chr> <chr>
1 amenity animal_boarding
2 amenity animal_breeding
3 amenity animal_shelter
4 amenity animal_training
5 amenity arts_centre
6 amenity atm
7 amenity baby_hatch
8 amenity baking_oven
9 amenity bank
10 amenity bar
# ℹ 127 more rows
Api key
Using the Google map service, you need to get an API key.
api_secret <- "xyz"
register_google(key = api_secret)Retreive the map data
You define the area of interest by defining the boundary box (bb) using the function getbb(), here it is Rostock.
# Using Google Api
rostock.sat <- get_map(getbb("Rostock"),
maptype = 'satellite',
source = "google",
api_key = api_secret,
zoom = 12)
#map <- get_openstreetmap( getbb('Rostock'), source="osm")
# Error in get_openstreetmap(getbb("Rostock"), source = "osm") :
# OSM is at least temporarily not supportedrostock.road <- get_map(getbb("Rostock"),
maptype = 'roadmap',
source = "google",
api_key = api_secret,
zoom = 12)Plot the base map using the function ggmap() from the ggmap R package.
ggmap(rostock.sat)Using the maps package
The maps package contains a lot of outlines of continents, countries, states, and counties that have been with R for a long time. The mapdata package contains a few more, higher-resolution outlines.
library(maps)
# library(mapdata)Read data
The maps package comes with a plotting function, but, we will use ggplot2 to plot the maps in the maps package. ggplot2 provides the map_data() function to turn data from the maps package into a data frame suitable for plotting with ggplot2.
# Baltic Countries
baltic.countries <- c("Germany",
"Denmark",
"Sweden",
"Finland",
"Estonia",
"Latvia",
"Lithuania",
"Poland")
# Retrieve the map data
baltic.countries.maps <- map_data("world", region = baltic.countries)Structure of the data frame
Look at the data structure:
dim(baltic.countries.maps)[1] 2836 6
head(baltic.countries.maps) long lat group order region subregion
1 20.61133 60.04068 1 1 Finland Aland Islands
2 20.60342 60.01694 1 2 Finland Aland Islands
3 20.52178 60.01167 1 3 Finland Aland Islands
4 20.48750 60.03276 1 4 Finland Aland Islands
5 20.41123 60.03013 1 5 Finland Aland Islands
6 20.39795 60.04068 1 6 Finland Aland Islands
The columns group and order are very important columns for plotting! order shows in which order ggplot should “connect the dots”. The group argument controls whether adjacent points should be connected by lines. If they are in the same group, then they get connected, but if they are in different groups then they do not. Essentially, having two points in different groups means that ggplot “lifts the pen” when going between them.
Plot the map
Maps in this format can be plotted with geom_polygon(). This function draws lines between points and “closes them up” (i.e. draws a line from the last point back to the first point). You have to map the group aesthetic to the group column with aes(group = ).
The argument coord_fixed() is very important when drawing the maps. It fixes the relationship between one unit in the y direction and one unit in the x direction. Then, even if you change the outer dimensions of the plot (i.e. by changing the window size or the size of the pdf file you are saving it to (in ggsave for example)), the aspect ratio remains unchanged.
ggplot(baltic.countries.maps,
aes(x = long, y = lat)) +
geom_polygon(aes(group = group),
fill = "grey80",
col = "black")+
theme_void()+
theme(legend.position = "none") +
coord_fixed(1.3)Colour the countries
ggplot(baltic.countries.maps,
aes(x = long, y = lat)) +
geom_polygon(aes(group = group, fill = region),
col = "grey30",
linetype = "solid")+
scale_fill_viridis_d() +
theme_void()+
theme(legend.position = "none") +
coord_fixed(1.3)Label the countries
# Compute the centroid as the mean longitude and lattitude
# Used as label coordinate for country's names
region.lab.data <- baltic.countries.maps %>%
group_by(region) %>%
summarise(long = mean(long), lat = mean(lat))ggplot(baltic.countries.maps,
aes(x = long, y = lat)) +
geom_polygon(aes( group = group,
fill = region))+
geom_text(aes(label = region),
data = region.lab.data,
size = 3,
hjust = 0.5)+
scale_fill_viridis(discrete = TRUE)+
theme_void()+
theme(legend.position = "none")Add points to the map
cities <- data.frame(
long = c(12.1400211, 18.0710935),
lat = c(54.0886707, 59.3251172),
names = c("Rostock", "Stockholm"),
stringsAsFactors = FALSE) ggplot(baltic.countries.maps,
aes(x = long, y = lat)) +
geom_polygon(aes(group = group,
fill = region))+
scale_fill_viridis(discrete = TRUE)+
theme_void()+
theme(legend.position = "none") +
coord_fixed(1.3) +
geom_point(data = cities,
aes(x = long, y = lat),
color = "black",
size = 5)Add some facts about the countries
You could also plot some information about those countries. Here we find some data for each country:
https://ec.europa.eu/eurostat/databrowser/view/tps00001__custom_13107327/settings_1/table?lang=en.
Save the data in a folder of your choice, I name it data/eurostat.
population <- read_xlsx("./data/eurostat/tps00001_page_spreadsheet.xlsx",
sheet = "Sheet 1",
range = "A10:B17",
col_names = FALSE)
colnames(population) <- c("region", "value")We now have the numbers that we want, but we need to attach those to every point on polygons of the countries. This is a job for inner_join() from the dplyr package:
baltic.countries.pop <- inner_join(baltic.countries.maps,
population,
by = "region")ggplot(baltic.countries.pop,
aes(x = long, y = lat)) +
geom_polygon(aes(group = group,
fill = value/1000000))+
geom_polygon(aes(group = group),
color = "black",
fill = NA) +
scale_fill_viridis(discrete = FALSE)+
labs(fill = "Mio. people") +
theme_void()+
theme(legend.position = "right") +
coord_fixed(1.3)How to cite R
“All analyses were performed using R Statistical Software (version 4.4.0; R Core Team 2024)”.
Reference: R Core Team (2024). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.
citation()To cite R in publications use:
R Core Team (2024). _R: A Language and Environment for Statistical
Computing_. R Foundation for Statistical Computing, Vienna, Austria.
<https://www.R-project.org/>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Manual{,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2024},
url = {https://www.R-project.org/},
}
We have invested a lot of time and effort in creating R, please cite it
when using it for data analysis. See also 'citation("pkgname")' for
citing R packages.
version$version.string[1] "R version 4.4.0 (2024-04-24 ucrt)"
citation("tidyverse")Um Paket 'tidyverse' in Publikationen zu zitieren, nutzen Sie bitte:
Wickham H, Averick M, Bryan J, Chang W, McGowan LD, François R,
Grolemund G, Hayes A, Henry L, Hester J, Kuhn M, Pedersen TL, Miller
E, Bache SM, Müller K, Ooms J, Robinson D, Seidel DP, Spinu V,
Takahashi K, Vaughan D, Wilke C, Woo K, Yutani H (2019). "Welcome to
the tidyverse." _Journal of Open Source Software_, *4*(43), 1686.
doi:10.21105/joss.01686 <https://doi.org/10.21105/joss.01686>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Article{,
title = {Welcome to the {tidyverse}},
author = {Hadley Wickham and Mara Averick and Jennifer Bryan and Winston Chang and Lucy D'Agostino McGowan and Romain François and Garrett Grolemund and Alex Hayes and Lionel Henry and Jim Hester and Max Kuhn and Thomas Lin Pedersen and Evan Miller and Stephan Milton Bache and Kirill Müller and Jeroen Ooms and David Robinson and Dana Paige Seidel and Vitalie Spinu and Kohske Takahashi and Davis Vaughan and Claus Wilke and Kara Woo and Hiroaki Yutani},
year = {2019},
journal = {Journal of Open Source Software},
volume = {4},
number = {43},
pages = {1686},
doi = {10.21105/joss.01686},
}
citation("viridis")To cite viridis/viridisLite in publications use:
Simon Garnier, Noam Ross, Robert Rudis, Antônio P. Camargo, Marco
Sciaini, and Cédric Scherer (2024). viridis(Lite) -
Colorblind-Friendly Color Maps for R. viridis package version 0.6.5.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Manual{,
title = {{viridis(Lite)} - Colorblind-Friendly Color Maps for R},
author = {{Garnier} and {Simon} and {Ross} and {Noam} and {Rudis} and {Robert} and {Camargo} and Antônio Pedro and {Sciaini} and {Marco} and {Scherer} and {Cédric}},
year = {2024},
note = {viridis package version 0.6.5},
url = {https://sjmgarnier.github.io/viridis/},
doi = {10.5281/zenodo.4679423},
}
citation("readxl")Um Paket 'readxl' in Publikationen zu zitieren, nutzen Sie bitte:
Wickham H, Bryan J (2023). _readxl: Read Excel Files_. R package
version 1.4.3, <https://CRAN.R-project.org/package=readxl>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Manual{,
title = {readxl: Read Excel Files},
author = {Hadley Wickham and Jennifer Bryan},
year = {2023},
note = {R package version 1.4.3},
url = {https://CRAN.R-project.org/package=readxl},
}
citation("rnaturalearth")Um Paket 'rnaturalearth' in Publikationen zu zitieren, nutzen Sie
bitte:
Massicotte P, South A (2023). _rnaturalearth: World Map Data from
Natural Earth_. R package version 1.0.1,
<https://CRAN.R-project.org/package=rnaturalearth>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Manual{,
title = {rnaturalearth: World Map Data from Natural Earth},
author = {Philippe Massicotte and Andy South},
year = {2023},
note = {R package version 1.0.1},
url = {https://CRAN.R-project.org/package=rnaturalearth},
}
citation("terra")Um Paket 'terra' in Publikationen zu zitieren, nutzen Sie bitte:
Hijmans R (2024). _terra: Spatial Data Analysis_. R package version
1.7-78, <https://CRAN.R-project.org/package=terra>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Manual{,
title = {terra: Spatial Data Analysis},
author = {Robert J. Hijmans},
year = {2024},
note = {R package version 1.7-78},
url = {https://CRAN.R-project.org/package=terra},
}
citation("tidyterra")If you use this software, please cite our article in the Journal of
Open Source Software.
Hernangómez D (2023). "Using the tidyverse with terra objects: the
tidyterra package." _Journal of Open Source Software_, *8*(91), 5751.
ISSN 2475-9066, doi:10.21105/joss.05751
<https://doi.org/10.21105/joss.05751>,
<https://doi.org/10.21105/joss.05751>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Article{R-tidyterra,
title = {Using the {tidyverse} with {terra} objects: the {tidyterra} package},
doi = {10.21105/joss.05751},
author = {Diego Hernangómez},
year = {2023},
url = {https://doi.org/10.21105/joss.05751},
publisher = {The Open Journal},
volume = {8},
number = {91},
pages = {5751},
journal = {Journal of Open Source Software},
issn = {2475-9066},
}
citation("sf")To cite package sf in publications, please use:
Pebesma, E., & Bivand, R. (2023). Spatial Data Science: With
Applications in R. Chapman and Hall/CRC.
https://doi.org/10.1201/9780429459016
Pebesma, E., 2018. Simple Features for R: Standardized Support for
Spatial Vector Data. The R Journal 10 (1), 439-446,
https://doi.org/10.32614/RJ-2018-009
To see these entries in BibTeX format, use 'print(<citation>,
bibtex=TRUE)', 'toBibtex(.)', or set
'options(citation.bibtex.max=999)'.
citation("ggspatial")Um Paket 'ggspatial' in Publikationen zu zitieren, nutzen Sie bitte:
Dunnington D (2023). _ggspatial: Spatial Data Framework for ggplot2_.
R package version 1.1.9,
<https://CRAN.R-project.org/package=ggspatial>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Manual{,
title = {ggspatial: Spatial Data Framework for ggplot2},
author = {Dewey Dunnington},
year = {2023},
note = {R package version 1.1.9},
url = {https://CRAN.R-project.org/package=ggspatial},
}
citation("icesDatras")Um Paket 'icesDatras' in Publikationen zu zitieren, nutzen Sie bitte:
Millar C, Kvaavik C, Villamor A, Large S, Magnusson A (2023).
_icesDatras: DATRAS Trawl Survey Database Web Services_. R package
version 1.4.1, <https://CRAN.R-project.org/package=icesDatras>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Manual{,
title = {icesDatras: DATRAS Trawl Survey Database Web Services},
author = {Colin Millar and Cecilia Kvaavik and Adriana Villamor and Scott Large and Arni Magnusson},
year = {2023},
note = {R package version 1.4.1},
url = {https://CRAN.R-project.org/package=icesDatras},
}
citation("icesVocab")Um Paket 'icesVocab' in Publikationen zu zitieren, nutzen Sie bitte:
Millar C, Magnusson A (2022). _icesVocab: ICES Vocabularies Database
Web Services_. R package version 1.2.0,
<https://CRAN.R-project.org/package=icesVocab>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Manual{,
title = {icesVocab: ICES Vocabularies Database Web Services},
author = {Colin Millar and Arni Magnusson},
year = {2022},
note = {R package version 1.2.0},
url = {https://CRAN.R-project.org/package=icesVocab},
}
citation("ggmap")Um Paket 'ggmap' in Publikationen zu zitieren, nutzen Sie bitte:
D. Kahle and H. Wickham. ggmap: Spatial Visualization with ggplot2.
The R Journal, 5(1), 144-161. URL
http://journal.r-project.org/archive/2013-1/kahle-wickham.pdf
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Article{,
author = {David Kahle and Hadley Wickham},
title = {ggmap: Spatial Visualization with ggplot2},
journal = {The R Journal},
year = {2013},
volume = {5},
number = {1},
pages = {144--161},
url = {https://journal.r-project.org/archive/2013-1/kahle-wickham.pdf},
}
citation("osmdata")To cite osmdata in publications use:
Mark Padgham, Bob Rudis, Robin Lovelace, Maëlle Salmon (2017).
"osmdata." _Journal of Open Source Software_, *2*(14), 305.
doi:10.21105/joss.00305 <https://doi.org/10.21105/joss.00305>,
<https://joss.theoj.org/papers/10.21105/joss.00305>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Article{,
title = {osmdata},
author = {{Mark Padgham} and {Bob Rudis} and {Robin Lovelace} and {Maëlle Salmon}},
journal = {Journal of Open Source Software},
year = {2017},
volume = {2},
number = {14},
pages = {305},
month = {jun},
publisher = {The Open Journal},
url = {https://joss.theoj.org/papers/10.21105/joss.00305},
doi = {10.21105/joss.00305},
}
citation("maps")Um Paket 'maps' in Publikationen zu zitieren, nutzen Sie bitte:
Becker OScbRA, Minka ARWRvbRBEbTP, Deckmyn. A (2023). _maps: Draw
Geographical Maps_. R package version 3.4.2,
<https://CRAN.R-project.org/package=maps>.
Ein BibTeX-Eintrag für LaTeX-Benutzer ist
@Manual{,
title = {maps: Draw Geographical Maps},
author = {Original S code by Richard A. Becker and Allan R. Wilks. R version by Ray Brownrigg. Enhancements by Thomas P Minka and Alex Deckmyn.},
year = {2023},
note = {R package version 3.4.2},
url = {https://CRAN.R-project.org/package=maps},
}
ACHTUNG: Diese Zitationsinformation wurde aus der DESCRIPTION-Datei
automatisch generiert. Evtl. ist manuelle Nachbearbeitung nötig, siehe
'help("citation")'.
Session Info
sessionInfo()R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8
[3] LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C
[5] LC_TIME=German_Germany.utf8
time zone: Europe/Berlin
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] maps_3.4.2 osmdata_0.2.5 ggmap_4.0.0
[4] ggspatial_1.1.9 icesVocab_1.2.0 icesDatras_1.4.1
[7] sf_1.0-16 tidyterra_0.6.1 terra_1.7-78
[10] rnaturalearth_1.0.1 readxl_1.4.3 viridis_0.6.5
[13] viridisLite_0.4.2 lubridate_1.9.3 forcats_1.0.0
[16] stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2
[19] readr_2.1.5 tidyr_1.3.1 tibble_3.2.1
[22] ggplot2_3.5.1 tidyverse_2.0.0
loaded via a namespace (and not attached):
[1] tidyselect_1.2.1 farver_2.1.2 bitops_1.0-8
[4] fastmap_1.2.0 digest_0.6.35 timechange_0.3.0
[7] lifecycle_1.0.4 magrittr_2.0.3 compiler_4.4.0
[10] rlang_1.1.3 tools_4.4.0 utf8_1.2.4
[13] yaml_2.3.8 data.table_1.15.4 knitr_1.47
[16] labeling_0.4.3 htmlwidgets_1.6.4 bit_4.0.5
[19] classInt_0.4-10 curl_5.2.1 plyr_1.8.9
[22] xml2_1.3.6 KernSmooth_2.23-22 withr_3.0.0
[25] grid_4.4.0 fansi_1.0.6 e1071_1.7-14
[28] colorspace_2.1-0 scales_1.3.0 isoband_0.2.7
[31] cli_3.6.2 rmarkdown_2.26 crayon_1.5.2
[34] generics_0.1.3 rstudioapi_0.16.0 httr_1.4.7
[37] tzdb_0.4.0 DBI_1.2.2 proxy_0.4-27
[40] rvest_1.0.4 parallel_4.4.0 selectr_0.4-2
[43] cellranger_1.1.0 vctrs_0.6.5 jsonlite_1.8.8
[46] hms_1.1.3 bit64_4.0.5 jpeg_0.1-10
[49] units_0.8-5 rematch_2.0.0 glue_1.7.0
[52] codetools_0.2-20 stringi_1.8.4 gtable_0.3.5
[55] munsell_0.5.1 pillar_1.9.0 rappdirs_0.3.3
[58] htmltools_0.5.8.1 rnaturalearthdata_1.0.0 R6_2.5.1
[61] httr2_1.0.1 vroom_1.6.5 evaluate_0.24.0
[64] png_0.1-8 class_7.3-22 Rcpp_1.0.12
[67] gridExtra_2.3 xfun_0.44 pkgconfig_2.0.3